//
//  HPDetailCollectionReusableView.m
//  Mall
//
//  Created by 孙飞燕 on 16/10/20.
//  Copyright © 2016年 孙飞燕. All rights reserved.
//

#import "HPDetailCollectionReusableView.h"

@implementation HPDetailCollectionReusableView
- (UIView *)headView{
    if (!_headView) {
        _headView = [[UIView alloc]initWithFrame:self.frame];
        [_headView addSubview:self.synthesizeBtn];
        [_headView addSubview:self.volumeBtn];
        [_headView addSubview:self.priceBtn];

    }
    return _headView;
}
- (UIButton *)synthesizeBtn{
    if (!_synthesizeBtn) {
        _synthesizeBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        _synthesizeBtn.frame = CGRectMake(10, 10, 50, 30);
        [_synthesizeBtn setTitle:@"综合" forState:UIControlStateNormal];
        [_synthesizeBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        [_synthesizeBtn addTarget:self action:@selector(changeAction:) forControlEvents:UIControlEventTouchUpInside];
        _synthesizeBtn.tag = 11;
    }
    return _synthesizeBtn;
}

- (UIButton *)volumeBtn{
    if (!_volumeBtn) {
        _volumeBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        _volumeBtn.frame = CGRectMake(80, 10, 50, 30);
        [_volumeBtn setTitle:@"销量" forState:UIControlStateNormal];
        [_volumeBtn addTarget:self action:@selector(changeAction:) forControlEvents:UIControlEventTouchUpInside];
        _volumeBtn.tag = 12;


    }
    return _volumeBtn;
}

- (UIButton *)priceBtn{
    if (!_priceBtn) {
        _priceBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        _priceBtn.frame = CGRectMake(150, 10, 50, 30);
        [_priceBtn setTitle:@"价格" forState:UIControlStateNormal];
        [_priceBtn addTarget:self action:@selector(changeAction:) forControlEvents:UIControlEventTouchUpInside];
        _priceBtn.tag = 13;

    }
    return _priceBtn;
}

- (void)changeAction:(UIButton *)sender{
    if (YES) {
        if ([self.delegate respondsToSelector:@selector(hpDetailCollectionResuableViewDelegate:andFlag:)]) {
            [self.delegate hpDetailCollectionResuableViewDelegate:self andFlag:(int)sender.tag];
            
        }
    }
}

@end
